import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/login/doLogin',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/login/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}

export function getUserPageList(params) {
  return request({
    url: '/user/userPageList',
    method: 'post',
    params
  })
}

export function createUser(params) {
  return request({
    url: '/user/userAdd',
    method: 'post',
    params
  })
}

export function userUpdate(params) {
  return request({
    url: '/user/userUpdate',
    method: 'post',
    params
  })
}

export function updateUserStatus(id,status) {
  return request({
    url: `/user/updateUserStatus/${id}/${status}`,
    method: 'get',
  })
}

export function deleteUser(id) {
  return request({
    url: '/user/deleteUser',
    method: 'get',
    params: { id }
  })
}

export function userInfo(id) {
  return request({
    url: '/user/userInfo',
    method: 'get',
    params: { id }
  })
}
